import * as serviceApi from '../services/inv';

export default {
  namespace: 'inv',

  state: {
  },

  effects: {
    *getByBillId({ payload, callback }, { call, put }) {
      const res = yield call(serviceApi.getByBillId, payload)
      if (callback)
        callback(res);
    },
    *getItemsByInvId({ payload, callback }, { call, put }) {
      const res = yield call(serviceApi.getItemsByInvId, payload)
      if (callback)
        callback(res);
    },
    *getItemsByBillId({ payload, callback }, { call, put }) {
      const res = yield call(serviceApi.getItemsByBillId, payload)
      if (callback)
        callback(res);
    },
    *lockInv({ payload, callback }, { call, put }) {
      const res = yield call(serviceApi.lockInv, payload)
      if (callback)
        callback(res);
    },
    *addInv({ payload, callback }, { call, put }) {
      const res = yield call(serviceApi.addInv, payload)
      if (callback)
        callback(res);
    },
    *saveInv({ payload, callback }, { call, put }) {
      const res = yield call(serviceApi.saveInv, payload)
      if (callback)
        callback(res);
    },
    *deleteInv({ payload, callback }, { call, put }) {
      const res = yield call(serviceApi.deleteInv, payload)
      if (callback)
        callback(res);
    },
    // *deleteInvItem({ payload, callback }, { call, put }) {
    //   const res = yield call(serviceApi.deleteInvItem, payload)
    //   if (callback)
    //     callback(res);
    // },
    // *updateInvItem({ payload, callback }, { call, put }) {
    //   const res = yield call(serviceApi.updateInvItem, payload)
    //   if (callback)
    //     callback(res);
    // },
    *changeInvFPS({ payload, callback }, { call, put }) {
      const res = yield call(serviceApi.changeInvFPS, payload)
      if (callback)
        callback(res);
    },
    *changeInvTDS({ payload, callback }, { call, put }) {
      const res = yield call(serviceApi.changeInvTDS, payload)
      if (callback)
        callback(res);
    },
  },

  reducers: {

  },
};
